"""
#!/usr/bin/python3
# -*- coding: utf-8 -*-
@CTime      : 2018/10/28 17:34
@Email      : ysling129.com
@File       : PostgresqlDispost.py
@Software   : PyCharm
@Description:
"""
__author__ = 'ling'


import psycopg2 as pg
from  psycopg2 import errorcodes as err


class PGDispost:

    def __init__(self, user='postgres', password='postgres', host='127.0.0.1', port=5432, dbname='postgres'):
        self.user = user
        self.password = password
        self.host = host
        self.port = port
        self.database = dbname
        try:
            self.mysql = pg.connect(user=self.user, password=self.password, port=self.port, dbname=self.database)
            print("----------------------------------------\n--\t进入数据库\n----------------------------------------\n")
        except err:
            print(err)


if __name__ == '__main__':
    a = PGDispost(dbname='postgres', port=5432, user='postgres',password='123456')